From 4a4bb6bd608992d02c85c3c672aaed9128740c83 Mon Sep 17 00:00:00 2001 From: "awilliam@xenbuild.aw" Date: Tue, 9 May 2006 11:47:15 -0600 Subject: [PATCH] [IA64] linux: XENMEM op work around xen/ia64 XENMEM_increase_reservation, XENMEM_decrease_reservation, XENMEM_populate_reservation are broken. work around for it. This patch should be removed after those hypercalls are fixed. Signed-off-by: Isaku Yamahata --- .../arch/ia64/xen/hypervisor.c | 37 +++++++++++++++++++ .../include/asm-ia64/hypercall.h | 30 +++++++++++++++ 2 files changed, 67 insertions(+) diff --git a/linux-2.6-xen-sparse/arch/ia64/xen/hypervisor.c b/linux-2.6-xen-sparse/arch/ia64/xen/hypervisor.c index e6b082a31e..403d2235a3 100644 --- a/linux-2.6-xen-sparse/arch/ia64/xen/hypervisor.c +++ b/linux-2.6-xen-sparse/arch/ia64/xen/hypervisor.c @@ -35,6 +35,43 @@ #define balloon_unlock(flags) ((void)flags) #endif +//XXX xen/ia64 copy_from_guest() is broken. +// This is a temporal work around until it is fixed. +// used by balloon.c netfront.c +int +ia64_xenmem_reservation_op(unsigned long op, + struct xen_memory_reservation* reservation__) +{ + struct xen_memory_reservation reservation = *reservation__; + unsigned long* frame_list = reservation__->extent_start; + unsigned long nr_extents = reservation__->nr_extents; + int ret = 0; + + BUG_ON(op != XENMEM_increase_reservation && + op != XENMEM_decrease_reservation && + op != XENMEM_populate_physmap); + + while (nr_extents > 0) { + int tmp_ret; + volatile unsigned long dummy; + + reservation.extent_start = frame_list; + reservation.nr_extents = nr_extents; + + dummy = frame_list[0];// re-install tlb entry before hypercall + tmp_ret = ____HYPERVISOR_memory_op(op, &reservation); + if (tmp_ret < 0) { + if (ret == 0) { + ret = tmp_ret; + } + break; + } + frame_list += tmp_ret; + nr_extents -= tmp_ret; + ret += tmp_ret; + } + return ret; +} //XXX same as i386, x86_64 contiguous_bitmap_set(), contiguous_bitmap_clear() // move those to lib/contiguous_bitmap? diff --git a/linux-2.6-xen-sparse/include/asm-ia64/hypercall.h b/linux-2.6-xen-sparse/include/asm-ia64/hypercall.h index d81e4d1598..eba05a4c33 100644 --- a/linux-2.6-xen-sparse/include/asm-ia64/hypercall.h +++ b/linux-2.6-xen-sparse/include/asm-ia64/hypercall.h @@ -195,12 +195,42 @@ HYPERVISOR_multicall( return _hypercall2(int, multicall, call_list, nr_calls); } +#ifndef CONFIG_XEN_IA64_DOM0_VP static inline int HYPERVISOR_memory_op( unsigned int cmd, void *arg) { return _hypercall2(int, memory_op, cmd, arg); } +#else +//XXX xen/ia64 copy_from_guest() is broken. +// This is a temporal work around until it is fixed. +static inline int +____HYPERVISOR_memory_op( + unsigned int cmd, void *arg) +{ + return _hypercall2(int, memory_op, cmd, arg); +} + +#include +int ia64_xenmem_reservation_op(unsigned long op, + struct xen_memory_reservation* reservation__); +static inline int +HYPERVISOR_memory_op( + unsigned int cmd, void *arg) +{ + switch (cmd) { + case XENMEM_increase_reservation: + case XENMEM_decrease_reservation: + case XENMEM_populate_physmap: + return ia64_xenmem_reservation_op(cmd, + (struct xen_memory_reservation*)arg); + default: + return ____HYPERVISOR_memory_op(cmd, arg); + } + /* NOTREACHED */ +} +#endif static inline int HYPERVISOR_event_channel_op( -- 2.30.2